﻿function submitAndRedirect(formContainer, targetUrl) {
    var formSelector = formContainer + " form";
    $(formSelector).ajaxSubmit({
        success: function (responseInfo) {
            if (responseInfo.IsSuccessful == false) {
                alert(responseInfo.statusMessage);
            }
            else {
                if (targetUrl==null || targetUrl == "currenturl") {
                    window.location.reload();
                }
                else {
                    window.location = targetUrl;
                }
            }
        },
        data: { "isAjaxDeal": "true" }
    });
}

function submitAndLoad(formContainer,loadContainer, targetUrl) {
    var formSelector = formContainer + " form";
    $(formSelector).ajaxSubmit({
        success: function (responseInfo) {
            if (responseInfo.IsSuccessful == false) {
                alert(responseInfo.statusMessage);
            }
            else {
                $(loadContainer).load(targetUrl);
            }
        },
        data: { "isAjaxDeal": "true" }
    });
}